package com.haixiaoke.saas.enterprise.department.controller;

import com.haixiaoke.saas.common.annotation.Log;
import com.haixiaoke.saas.common.annotation.TenantScope;
import com.haixiaoke.saas.common.core.domain.AjaxResult;
import com.haixiaoke.saas.common.core.page.TableDataInfo;
import com.haixiaoke.saas.common.enums.BusinessType;
import com.haixiaoke.saas.common.tenant.TenantContext;
import com.haixiaoke.saas.common.utils.poi.ExcelUtil;
import com.haixiaoke.saas.department.domain.ElectronicVisa;
import com.haixiaoke.saas.department.domain.ElectronicVisaRecord;
import com.haixiaoke.saas.department.service.IElectronicVisaService;
import com.haixiaoke.saas.system.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 企业电子签信息Controller
 *
 * @author panda
 * @date 2024-05-29
 */
@RestController
@RequestMapping("/enterprise/department/electronicVisa")
public class EnterpriseElectronicVisaController extends BaseController {
    @Autowired
    private IElectronicVisaService electronicVisaService;

    /**
     * 获取企业电子签信息详细信息
     */
    @GetMapping
    @TenantScope
    public AjaxResult queryElectronicVisaByTenantId() {
        ElectronicVisa visa = electronicVisaService.selectElectronicVisaByTenantId(TenantContext.getTenantId());
        ElectronicVisa electronicVisa = new ElectronicVisa();
        electronicVisa.setContractTotalNumber(visa.getContractTotalNumber());
        electronicVisa.setContractUsedNumber(visa.getContractUsedNumber());
        electronicVisa.setContractLeftNumber(visa.getContractLeftNumber());
        return success(electronicVisa);
    }
}
